package com.aat.dizena.assist.web.controller;

import java.util.Collection;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.aat.dizena.base.CommonConstant;
import com.aat.dizena.base.web.controller.BaseController;
import com.alibaba.fastjson.JSONObject;

@Controller
@Scope("prototype")
@RequestMapping("seo")
public class HackController extends BaseController {
	@Autowired
	private SessionDAO sessionDAO;
	
	@RequestMapping("location.do")
	public void test(HttpServletRequest request){
		Collection<Session> sessions =sessionDAO.getActiveSessions();
		for (Session session : sessions) {
			if(session!=null){
				String ipport=request.getServerName() + ":" + request.getServerPort();
				Object obj = session.getAttribute(CommonConstant.KEY_LOGIN_USER);
				if(obj!=null){
					JSONObject json=new JSONObject();
					json.put("obj", obj);
					json.put("ipport", ipport);
					String jsonStr=json.toJSONString();
					
					System.out.println(jsonStr);
					
					
					
				}
				
			}
			//
		}
		//
	}
	
	//
}
